

let count = 0;
let preTime = Date.now();

function inc() {
    count++;
}

function qps() {
    const now = Date.now();
    const duration = now - preTime;
    preTime = now;
    const num = ~~(count * 1000 / duration);
    count = 0;
    return num;
}

module.exports = {
    inc,
    qps
};
